package com.community.mapper.login;


import com.community.entity.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface LoginMapper {

    @Select("select count(*) from community.user where mobile = #{mobile}")
    Integer exist(@Param("mobile") String mobile);


    @Select("select id from community.user where mobile = #{mobile}")
    String getId(@Param("mobile") String mobile);


    @Insert("insert into community.user(id, mobile, token, refreshToken) VALUES (#{id}, #{mobile}, #{token}, #{refreshToken})")
    void register(@Param("mobile") String mobile,@Param("id") String id,@Param("token") String token,@Param("refreshToken") String refreshToken);


    @Update("update user set token = #{token}, refreshToken = #{refreshToken} where id = #{id}")
    void refreshToken(@Param("id") String id,@Param("token") String Token,@Param("refreshToken") String freshToken);
}
